<?php

/**
 * This is the model class for table "ngfxaccount".
 *
 * The followings are the available columns in table 'ngfxaccount':
 * @property integer $id
 * @property integer $user_id
 * @property integer $country_id
 * @property string $email
 * @property string $email_pass
 * @property string $cl_pass
 * @property string $fw_email
 * @property string $fw_email_pass
 * @property string $phone
 * @property string $state
 * @property string $city
 * @property string $link
 * @property string $proxy
 * @property string $remarks
 * @property string $last_posted_date
 * @property string $date_of_birth
 * @property string $username
 * @property string $password
 * @property string $verify_code1
 * @property string $verify_code2
 * @property integer $working
 * @property integer $can_post
 * @property integer $have_post
 * @property integer $total_post
 * @property string $referral
 * @property string $insta_username
 * @property string $insta_password
 * @property string $insta_trading_account
 * @property string $insta_trader_password
 * @property string $insta_phone_password
 * @property string $insta_pin
 * @property string $nsta_investor_password
 * @property string $insta_server
 */
class Ngfxaccount extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Ngfxaccount the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'ngfxaccount';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('user_id, country_id, working,can_post,have_post,total_post', 'numerical', 'integerOnly'=>true),
			array('referral,email, email_pass, cl_pass, fw_email, fw_email_pass, phone, state, city, link, proxy, remarks, username, password, verify_code1, verify_code2,insta_username,insta_password,insta_trading_account,insta_trader_password,insta_phone_password,insta_pin,insta_investor_password,insta_server', 'length', 'max'=>255),
			array('last_posted_date, date_of_birth', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, user_id, country_id, email, email_pass, cl_pass, fw_email, fw_email_pass, can_post,have_post,total_post, last_posted_date, date_of_birth, username, password, verify_code1, verify_code2, working,referral,insta_username,insta_password,insta_trading_account,insta_trader_password,insta_phone_password,insta_pin,insta_investor_password,insta_server', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'user_id' => 'User',
			'country_id' => 'Country',
			'email' => 'Email',
			'email_pass' => 'Email Pass',
			'cl_pass' => 'Cl Pass',
			'fw_email' => 'Fw Email',
			'fw_email_pass' => 'Fw Email Pass',
			'phone' => 'Phone',
			'state' => 'State',
			'city' => 'City',
			'link' => 'Link',
			'proxy' => 'Proxy',
			'remarks' => 'Remarks',
			'last_posted_date' => 'Last Posted Date',
			'date_of_birth' => 'Date Of Birth',
			'username' => 'Username',
			'password' => 'Password',
			'verify_code1' => 'Verify Code1',
			'verify_code2' => 'Verify Code2',
			'working' => 'Working',
                        'can_post' => 'Can post',
                        'have_post' => 'Have post',
                        'total_post' => 'Total post',
                        'referral' => 'Referral',
                        'insta_username'=>'Insta email',
                        'insta_password'=>'Insta email password',
                        'insta_trading_account'=>'Insta trading account',
                        'insta_trader_password'=>'Insta trader password',
                        'insta_phone_password'=>'Insta phone password',
                        'insta_pin'=>'Insta pin',
                        'insta_investor_password'=>'Insta investor password',
                        'insta_server'=>'Insta server',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('country_id',$this->country_id);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('email_pass',$this->email_pass,true);
		$criteria->compare('cl_pass',$this->cl_pass,true);
		$criteria->compare('fw_email',$this->fw_email,true);
		$criteria->compare('fw_email_pass',$this->fw_email_pass,true);
		$criteria->compare('phone',$this->phone,true);
		$criteria->compare('state',$this->state,true);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('link',$this->link,true);
		$criteria->compare('proxy',$this->proxy,true);
		$criteria->compare('remarks',$this->remarks,true);
		$criteria->compare('last_posted_date',$this->last_posted_date,true);
		$criteria->compare('date_of_birth',$this->date_of_birth,true);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('password',$this->password,true);
		$criteria->compare('verify_code1',$this->verify_code1,true);
		$criteria->compare('verify_code2',$this->verify_code2,true);
		$criteria->compare('working',$this->working);
                $criteria->compare('can_post',$this->can_post);
                $criteria->compare('have_post',$this->have_post);
                $criteria->compare('total_post',$this->total_post);
                $criteria->compare('referral',$this->referral);
                $criteria->compare('insta_username',$this->insta_username);
                $criteria->compare('insta_password',$this->insta_password);                
                $criteria->compare('insta_trading_account',$this->insta_trading_account);
                $criteria->compare('insta_trader_password',$this->insta_trader_password);
                $criteria->compare('insta_phone_password',$this->insta_phone_password);
                $criteria->compare('insta_pin',$this->insta_pin);
                $criteria->compare('insta_investor_password',$this->insta_investor_password);
                $criteria->compare('insta_server',$this->insta_server);
                $criteria->order = 'total_post desc';
		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}